import {
  createRouter,
  createWebHistory,
  RouteRecordRaw
} from 'vue-router'

const routes :Array<RouteRecordRaw> = [{
    path: '/',
    name: 'login',
    component: () => import('../views/LoginView.vue')
  },
  {
    path: '/home',
    name: 'home',
    component: () => import('../views/HomeView.vue'),
    children: [{
        path: 'main',
        name: 'main',
        component: () => import('../views/MainView.vue')
      },
      {
        path: 'user',
        name: 'user',
        component: () => import('../views/UserView.vue')
      },
      {
        path: 'goods',
        name: 'goods',
        component: () => import('../views/GoodsView.vue')
      },
      {
        path: 'book',
        name: 'book',
        component: () => import('../views/RecommendView.vue')
      },
      {
        path: 'borrow',
        name: 'borrow',
        component: () => import('../views/ShoppingCartViews.vue')
      },
      {
        path: 'feedback',
        name: 'feedback',
        component: () => import('../views/Feedback.vue')
      },
      {
        path: 'statement',
        name: 'statement',
        component: () => import('../views/StatementView.vue')
      }
    ],
    redirect: '/home/main',
  },
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router